<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :showAttrs="showAttrs"
                :searchFormShowNumber="3"
                :optionWidth="200"
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>

<script>
  import AddOrUpdate from './productsample-add-or-update'
  import tableView from '@/components/tableView'
  import basicMixins from '@/utils/commonViewMixins'
  export default {
    mixins: [basicMixins],
    data () {
      return {
        searchAttrs:{
          sampleNo:{
            type: 'String',
            placeholder:'样品名称'
          },
          clientId:{
            placeholder:'客户名称',
            type: 'autoComplete',
            querySearchApiName: 'clientApi/getClientList'
          },
          dateTimeRange:{
            type: 'date',
            dateType: 'daterange',
            clearable: true
          }
        },
        showAttrs:{
          sampleNo: {
            label: '样品名称'
          },
          sampleWeightStr: {
            label: '克重'
          },
          clientName:{
            label: '客户名称'
          },
          sampleDate: {
            label: '打样时间',
            type: 'date'
          },
          samplePicture: {
            label: '样品图片',
            type: 'image'
          },
          sampleDrawing: {label: '图纸', showKey: 'sampleNo', type: 'file', width: 150},
          remark: {
            label: '备注'
          }
        },
        primaryKey: 'id',
        listApiName: 'productApi/listProductSample',
        deleteApiName: 'productApi/deleteProductSample',
        saveAuthName: 'product:productsample:save',
        deleteAuthName: 'product:productsample:delete'
      }
    },
    components: {
      AddOrUpdate,
      tableView
    }
  }
</script>
